package com.itheima.stock.controller;

import com.itheima.stock.api.StockControllerAPI;
import com.itheima.stock.entity.StockBusiness;
import com.itheima.stock.response.ResponseResult;
import com.itheima.stock.service.StockService;
import com.itheima.stock.vo.InnerMarketVO;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StockController implements StockControllerAPI {

    private final StockService stockService;

    public StockController(StockService stockService) {
        this.stockService = stockService;
    }

    @Override
    public ResponseResult<List<StockBusiness>> getStockBusiness() {
        List<StockBusiness> stockBusiness = stockService.getStockBusiness();
        return ResponseResult.ok(stockBusiness);
    }

    @Override
    public ResponseResult<List<InnerMarketVO>> innerIndexALL() {
        return ResponseResult.ok(stockService.innerIndexAll());
    }
}
